package ltd.hanamaki.study.generic;

public class GenericDemo04 {


    /**
     * 三数比大小
     * @param a
     * @param b
     * @param c
     * @return
     */
    /* 如果在泛型方法中想要 使用比较运算符 要继承 Comparable */
    public <T extends Comparable<T>> T max_min(T a, T b, T c) {
        T max = a;
        if (b.compareTo(a) > 0) {
            max = b;
        }
        if (c.compareTo(a) > 0) {
            max = c;
        }
        return max;
    }

    public static void main(String[] args) {

        System.out.println(new GenericDemo04().max_min(13, 4, 5));
        System.out.println(new GenericDemo04().max_min('A', 'B', 'T'));

    }



}




